feat: add support for feed scoped notifications - #1780
Merged
Conversation
davidgamez
marked this pull request as ready for review
July 28, 2026 19:26
Comment on lines
394
to
+412
| @@ -400,6 +400,16 @@ components: | |||
| type: string | |||
| description: The notification type to subscribe to. | |||
| example: "feed.published" | |||
| feed_ids: | |||
| type: array | |||
| items: | |||
| type: string | |||
| description: > | |||
| Feed stable IDs to subscribe to. Required (non-empty) for the | |||
| feed-scoped notification types feed.url_updated, | |||
| feed.url_availability and feed.coverage; must be omitted or empty | |||
| for other types. Validation is enforced in code, not the schema. | |||
| example: ["mdb-1", "mdb-42"] | |||
Contributor
There was a problem hiding this comment.
I'm wondering if we should add a description field so that when listing the notifications it could be more descriptive than
mdb-1 - feed.availability
and more like
TTC (gtfs) - feed.availability
Member
Author
There was a problem hiding this comment.
Great observation. Instead of a description that can be rigid, what about returning the following fields:
- data_type
- provider
- feed_name
The consumer can create the description and handle edge cases such as character counts.
Contributor
There was a problem hiding this comment.
I'm on board, since it includes more feed data, feeds_data would be a more suitable name
Member
Author
There was a problem hiding this comment.
Added feed's metadata, example:
{
"id": "f91224e8-9466-4825-a44f-bf78eec1813a",
"user_id": "tbUz14OLEIf0gsGw5ecbEbS34xQ2",
"notification_id": "feed.url_updated",
"active": true,
"created_at": "2026-07-28T19:03:45.301170Z",
"feeds": [
{
"feed_id": "mdb-100",
"data_type": "gtfs",
"provider": "Anaheim Resort Transportation (ART)",
"feed_name": ""
}
]
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Core changes:
feed.url_updated,feed.url_availabilityandfeed.coverage)/v1/notifications- Fully implemented/v1/subscriptions/{id}/v1/user/subscriptionsFrom our AI friend:
This pull request implements feed-scoped notification subscriptions, feature flag gating for notification management, and refines the handling of notification types and subscriptions. The main changes include enforcing feature flag checks for all subscription actions, supporting feed-scoped notification types with validation and join-table persistence, and improving the database cascade behavior for child collections. The implementation also introduces helper functions and refactors the API to return only allowed notification types to users.
Feature flag gating and validation:
isNotificationsEnabledfeature flag for the user, enforced via new helper methods and error messages. The specialadmin.event_summarynotification type also requires an additional feature flag (isAdminSummarySubscriptionEnabled). [1] [2] [3] [4] [5]Feed-scoped notification subscriptions:
feed.url_updated,feed.url_availability,feed.coverage) is added, requiring a non-empty list of feed IDs for these types. The feed IDs are validated for existence and persisted in thenotification_subscription_feedjoin table. [1] [2] [3] [4]Database and ORM improvements:
delete-orphanandpassive_deletesfor bothnotification_logsandnotification_subscription_feedscollections, ensuring proper cascading deletes and orphan removal. [1] [2]API and model refactoring:
NotificationTypeobjects to Pydantic models.Testing:
Expected behavior:
Explain and/or show screenshots for how you expect the pull request to work in your testing (in case other devices exhibit different behavior).
Testing tips:
Tested in dev with the following cURL commands:
Response:
Response:
Response:
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything